# Maintainer: Alexey Pavlov <alexpux@gmail.com>

pkgname=rcs
pkgver=5.9.4
pkgrel=2
pkgdesc='Revision Control System: manages multiple revisions of files'
url='https://www.gnu.org/software/rcs/'
license=('GPL3')
arch=('i686' 'x86_64')
groups=('base-devel')
makedepends=('groff')
source=("https://ftp.gnu.org/gnu/${pkgname}/${pkgname}-${pkgver}.tar.xz"
        rcs-5.9.4-upstream.patch
        rcs-5.9.4-update-gnulib.patch
        rcs-5.9.4-msys2.patch)
sha256sums=('063d5a0d7da1821754b80c639cdae2c82b535c8ff4131f75dc7bbf0cd63a5dff'
            '13ce49f2e1aa6aa864525a05ea4b47b1ede05cad3e8502f8c4993d5e13272589'
            '5ba9d241b2b8e8d35517bb91d3954ad74752f20bb98e9730fccf7a12c079ead1'
            '74a13f2c47085f9a60233265a2e33d61f56f2d01661695b3891207929c2421a3')

prepare() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  patch -p1 -i ${srcdir}/rcs-5.9.4-upstream.patch
  patch -p1 -i ${srcdir}/rcs-5.9.4-update-gnulib.patch
  patch -p1 -i ${srcdir}/rcs-5.9.4-msys2.patch

  autoreconf -fi
}

build() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  ./configure --build=${CHOST} --prefix=/usr
  make
}

check() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  make check
}

package() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  make prefix="${pkgdir}/usr" install
}
